package ca.liu.scaffoldingmvctest.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllStLogs", query = "select myStLog from StLog myStLog"),
		@NamedQuery(name = "findStLogById", query = "select myStLog from StLog myStLog where myStLog.id = ?1"),
		@NamedQuery(name = "findStLogByPrimaryKey", query = "select myStLog from StLog myStLog where myStLog.id = ?1"),
		@NamedQuery(name = "findStLogByValue", query = "select myStLog from StLog myStLog where myStLog.value = ?1"),
		@NamedQuery(name = "findStLogByValueContaining", query = "select myStLog from StLog myStLog where myStLog.value like ?1") })
@Table(schema = "public", name = "st_log")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "scaffoldingmvctest/ca/liu/scaffoldingmvctest/domain", name = "StLog")
public class StLog implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "id", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer id;
	/**
	 */

	@Column(name = "value")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String value;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "user_id", referencedColumnName = "id") })
	@XmlTransient
	StUser stUser;

	/**
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 */
	public Integer getId() {
		return this.id;
	}

	/**
	 */
	public void setValue(String value) {
		this.value = value;
	}

	/**
	 */
	public String getValue() {
		return this.value;
	}

	/**
	 */
	public void setStUser(StUser stUser) {
		this.stUser = stUser;
	}

	/**
	 */
	public StUser getStUser() {
		return stUser;
	}

	/**
	 */
	public StLog() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(StLog that) {
		setId(that.getId());
		setValue(that.getValue());
		setStUser(that.getStUser());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("value=[").append(value).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof StLog))
			return false;
		StLog equalCheck = (StLog) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
